﻿using System;
using System.Globalization;

namespace Protocol.Data
{
    public class IdAttribute : Attribute
    {
        public int Key { get; set; }

        public string KeyAsString
        {
            get { return ToString(); }
        }

        public IdAttribute(int id)
        {
            Key = id;
        }

        public IdAttribute(string key)
        {
            Key = int.Parse(key, NumberStyles.HexNumber);
        }

        public override string ToString()
        {
            return Key.ToString("x8");
        }
    }
}
